# 基本捕获异常
# try:
#     f = open('/Users/zhangguoqiang/PycharmProjects/pythonProject/fileDaemon/test.txt', 'r', encoding="UTF-8")
# except:
#     f = open('/Users/zhangguoqiang/PycharmProjects/pythonProject/fileDaemon/test.txt', 'w', encoding="UTF-8")
#
# # 捕获指定的异常
# try:
#     print(name)
# except NameError as e:
#     print("出现了变量未定义的异常")
#     print(e)
#
# # 捕获多个异常
# try:
#     1/0
# except (NameError, ZeroDivisionError) as e:
#     print("出现了变量未定义的异常或者除以0异常")


# try:
#     name
#     1/0
# except Exception as e:
#     print("出现异常了")